package Action;

import java.io.IOException;
import java.util.*;
import java.text.ParseException;
import java.text.SimpleDateFormat;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import Dao.coursedao;
import Entity.Self_Booked_Page;
import Entity.User;
import mapper.Coursemapper;


/**
 * Servlet implementation class Self_Booked_Page
 */
@WebServlet("/Self_boocked")
public class Self_boocked extends HttpServlet {
	private static final long serialVersionUID = 1L;
       
    /**
     * @see HttpServlet#HttpServlet()
     */
    public Self_boocked() {
        super();
        // TODO Auto-generated constructor stub
    }

	/**
	 * @see HttpServlet#service(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		// TODO Auto-generated method stub
        int page_n= 1;
        HttpSession session = request.getSession();
        User user =(User) session.getAttribute("user");
        String id = user.getUid();
        Date date1=new Date();
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
        String da=sdf.format(date1);
        java.sql.Date date = new java.sql.Date(date1.getTime());
        Self_Booked_Page sbp = new Self_Booked_Page();
        sbp.setPage_n(page_n);
        sbp.setDate(date);
        sbp.setId(id);
        Coursemapper cm = new coursedao();
        sbp =cm.getPage(sbp);
        request.setAttribute("sbp",sbp);
        request.getRequestDispatcher("t_check.jsp").forward(request,response);
	}

}
